#include <bits/stdc++.h>
using namespace std;

class Solution
{
public:
    int main()
    {
        int n;
        cin >> n;
        int maxContinuousInc = 0;
        int continuousInc = 0;
        int last = 0;
        int cur = 0;
        for (int i = 0; i < n; ++i)
        {
            cin >> cur;
            if (cur == last + 1)
            {
                ++continuousInc;
            }
            else
            {
                maxContinuousInc = max(maxContinuousInc, continuousInc);
                continuousInc = 1;
            }
            last = cur;
        }
        maxContinuousInc = max(maxContinuousInc, continuousInc);
        cout << maxContinuousInc;
        return 0;
    }
};

#ifndef __LOCAL_TEST__
int main()
{
    return Solution().main();
}
#endif